﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Microsoft.SqlServer.Server;

namespace NC.Infrastructure.Extension
{
   public class HttpMethodHelper
    {
        /// <summary>
        /// 根据MethodString
        /// </summary>
        /// <param name="method">method字符串</param>
        /// <returns>HttpMethod内置对象</returns>
       public static HttpMethod GetMethodByString(string method)
       {
           method = method.ToLower();
            if(string.Equals(method,"get"))
                return HttpMethod.Get;
            if(string.Equals(method,"post"))
                return HttpMethod.Post;
           if (string.Equals(method, "put"))
               return HttpMethod.Put;
           if(string.Equals(method,"delete"))
                return HttpMethod.Delete;
           if(string.Equals(method,"potions"))
                return HttpMethod.Options;   
           if(string.Equals(method,"head"))
                return HttpMethod.Head;
           if(string.Equals(method,"trace"))
                return HttpMethod.Trace;
           return HttpMethod.Get;
       }
    }
}
